impl Solution {
    pub fn find_the_distance_value(mut arr1: Vec<i32>, mut arr2: Vec<i32>, d: i32) -> i32 {
        arr2.sort();
        let mut count = 0;
        for i in arr1 {
            match arr2.binary_search(&i) {
                Err(ind) => {
                    if ind==0{
                        if arr2[0]-i>d{
                            count+=1;
                        }
                    }else{
                        if ind==arr2.len(){
                            if (arr2.last().unwrap()-i).abs()>d{
                                count+=1;
                            }
                        }else{
                                if i-arr2[ind-1]>d&&arr2[ind]-i>d{
                                    count+=1;
                                }
                            }
                    }
                    
                }
                _ => {
                }
            }
        }
        count
    }
}
